/*
 * 版权所有 (c) 华为技术有限公司 2022-2022
 */
package com.huawei.cameratest.data;

import android.graphics.Paint;
import android.hardware.camera2.CaptureRequest;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class CaptureRequestEx extends CaputureTag {
    public static CaptureRequest.Key CAMERA_SCENE_MODE_TV = instance("com.camera.capture.metadata.cameraSceneModeTv", Byte.class);
    public static CaptureRequest.Key ZOOM_RATIO = instance("com.camera.capture.metadata.zoomRatio", Byte.class);
    public static final Byte HOME_CAM = (byte) 0;
    public static final Byte AI_FITNESS = (byte) 1;
    public static final Byte VIDEO_CALL = (byte) 2;
    public static CaptureRequest.Key VIDEO_AUTO_ZOOM = instance("com.camera.capture.metadata.autoZoom", Byte.class);
    public static CaptureRequest.Key VIDEO_AUTO_ZOOM_CONFIG = instance("com.camera.capture.metadata.autoZoomConfig", Byte[].class);
    public static CaptureRequest.Key VIDEO_AUTO_BITRATE_MODE = instance("com.camera.capture.metadata.bitrateMode", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_ENCODEBITRATE = instance("com.camera.capture.metadata.encodeBitrate", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_IFRAMEINTERVAL = instance("com.camera.capture.metadata.iframeInterval", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_CABACMODE = instance("com.camera.capture.metadata.cabacMode", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_QUALITYPARAM = instance("com.camera.capture.metadata.qualityParam", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_REQUESTIFRAME = instance("com.camera.capture.metadata.requestIFrame", Byte[].class);
    public static CaptureRequest.Key VIDEO_AUTO_LTRREQ = instance("com.camera.capture.metadata.ltrReq", Byte[].class);
    public static CaptureRequest.Key VIDEO_AUTO_STREAMRESOLUTION = instance("com.camera.capture.metadata.elementaryStreamResolution", Integer[].class);
    public static CaptureRequest.Key VIDEO_AUTO_DROPNEXTFRAME = instance("com.camera.capture.metadata.dropNextFrame", Byte[].class);
    public static CaptureRequest.Key VIDEO_AUTO_PEAKRATIO = instance("com.camera.capture.metadata.peakRatio", Integer[].class);
    public static CaptureRequest.Key MIRROR = instance("com.camera.capture.metadata.previewMirror", Byte.class);
    public static CaptureRequest.Key AI_MODE = instance("com.camera.capture.metadata.skeletonDetection", Byte.class);
    public static CaptureRequest.Key AI_CONFIG = instance("com.camera.capture.metadata.skeletonDetectionConfig", Byte[].class);
    public static CaptureRequest.Key ROKID_HUE = instance("com.camera.capture.metadata.hue", Integer.class);
    public static CaptureRequest.Key ISP_UPDATE_PACKAGE = instance("com.camera.capture.metadata.updatePackage", byte[].class);
    public static CaptureRequest.Key RESIZE  = instance("com.camera.capture.metadata.postZoomRegion", Integer[].class);
    public static CaptureRequest.Key IMAGE_PAUSE = instance("com.camera.capture.metadata.imagePause", Integer.class);
    public static CaptureRequest.Key SET_OSD_IMG = instance("com.camera.capture.metadata.setOsdImg", Byte[].class);
    public static CaptureRequest.Key DYNAMIC_FPS = instance("com.camera.capture.metadata.dynamicFps", Byte[].class);
    public static CaptureRequest.Key ODM_META = instance("com.camera.capture.metadata.odmMeta", byte[].class);
    public static CaptureRequest.Key ROTATION_PICTURE_BY_HAL = instance("com.camera.capture.metadata.pictureRotationByHal", Integer.class);
    public static CaptureRequest.Key H264_SVC = instance("com.camera.capture.metadata.h264svc", Integer[].class);
    public static CaptureRequest.Key DYNAMIC_FORMAT = instance("com.camera.capture.metadata.dynamicFormat", Integer[].class);
    public static CaptureRequest.Key MAX_STREAM_LEN = instance("com.camera.capture.metadata.maxStreamLen", Integer[].class);
    public static final Integer[] RESIZE_RECT_CONFIG = new Integer[]{0, 0, 640, 480};
    public static final Integer[] RESIZE_RECT_CONFIG2 = new Integer[]{0, 0, 320, 240};
    public static final Byte[] AI_CONFIG_DATA = new Byte[]{4, 0, 0, 0};
    public static final Byte OPEN = (byte) 1;
    public static final Byte CLOSE = (byte) 0;
    public static final Byte[] OPEN_CONFIG = new Byte[]{0, 1};
    public static final Byte[] CLOSE_CONFIG = new Byte[]{0, 0};


    private static CaptureRequest.Key instance(String value, Class cla) {
        try {
            Class classes = Class.forName("android.hardware.camera2.CaptureRequest$Key");
            Constructor constructor = classes.getConstructor(String.class, Class.class);
            CaptureRequest.Key key = (CaptureRequest.Key) constructor.newInstance(value, cla);
            return key;
        } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
            e.printStackTrace();
            return null;
        }
    }
}